[jQuery] Improving click/toggle function
Posted
by Nimbuz
on Stack Overflow
See other posts from Stack Overflow
or by Nimbuz
Published on 2010-06-09T05:43:19Z
Indexed on
2010/06/09
5:52 UTC
Read the original article
Hit count: 126
$('.tabs a ').click(function () {
var a = $(this).attr('href');
if (a == '#tab-1') {
$('.btn-buy').hide();
$('.btn-sell').show();
} else {
$('.btn-sell').hide();
$('.btn-buy').show();
}
return false;
});
... it works, but the code is ugly, too many lines. Can it be reduced any further?
Thanks in advance for your help!
© Stack Overflow or respective owner